<?php
/**
 * 视图控制
 *
 * @authors yutent (yutent@doui.cc)
 * @date    2014-08-31 18:38:16
 *
 */
class Do_View {

    private $smarty;

    function __construct(){
        global $_G;
        require_cache(CORE . 'smarty/Smarty.class.php');
        spl_autoload_register("__autoload"); 
        $this->smarty = new Smarty;

        $this->smarty->setLeftDelimiter($_G['delimiter'][0]);
        $this->smarty->setRightDelimiter($_G['delimiter'][1]);
        $this->smarty->setCacheDir(ROOT . 'data/smarty_cache');
        $this->smarty->setCompileDir(ROOT . 'data/smarty_compile');
        $this->smarty->setTemplateDir(APPS);
    }

    function assign($name = '', $val = ''){
        return $this->smarty->assign($name, $val);
    }

    function render($tpl = ''){
        return $this->smarty->display($tpl);
    }
    
}
